<?php /*a:1:{s:78:"D:\phpstudy\PHPTutorial\WWW\d_school\application\admin\view\index\welcome.html";i:1559629443;}*/ ?>
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/echarts/3.8.0/echarts.min.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <blockquote class="layui-elem-quote">欢迎管理员：
                        <span class="x-red"><?php echo htmlentities($admin['username']); ?></span>！当前时间:<?php echo date('Y-m-d H:i:s'); ?>
                    </blockquote>
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-card">
                <div class="layui-card-header">数据统计</div>
                <div class="layui-card-header">
                    <form class="layui-form layui-col-space5" style="text-align: center;">
                        <div class="layui-inline layui-show-xs-block">
                            <input type="radio" name="type" value="1" title="天" lay-filter="type" checked>
                            <input type="radio" name="type" value="2" title="周" lay-filter="type">
                            <input type="radio" name="type" value="3" title="月" lay-filter="type">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="time1" id="date"  placeholder="" autocomplete="off" class="layui-input">
                            <input type="text" name="time2" id="month" style="display: none;" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn"  lay-submit="" lay-filter="search">筛选</button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-body">
                    <div id="main" style="height: 430px;"></div>
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-card">
                <div class="layui-card-header">系统信息</div>
                <div class="layui-card-body ">
                    <table class="layui-table">
                        <tbody>
                        <tr>
                            <th>版本</th>
                            <td>1.0.0</td>
                        </tr>
                        <tr>
                            <th>IP地址</th>
                            <td><?php echo request()->ip(); ?></td>
                        </tr>
                        <tr>
                            <th>服务器域名</th>
                            <td><?php echo $_SERVER['SERVER_NAME']; ?></td>
                        </tr>
                        <tr>
                            <th>操作系统</th>
                            <td><?php echo php_uname(); ?></td>
                        </tr>
                        <tr>
                            <th>运行环境</th>
                            <td><?php echo $_SERVER['SERVER_SOFTWARE']; ?></td>
                        </tr>
                        <tr>
                            <th>PHP版本</th>
                            <td><?php echo PHP_VERSION; ?></td>
                        </tr>
                        <tr>
                            <th>PHP运行方式</th>
                            <td><?php echo php_sapi_name(); ?></td>
                        </tr>
                        <tr>
                            <th>MYSQL版本</th>
                            <td><?php echo think\Db::query('select VERSION()')[0]['VERSION()']; ?></td>
                        </tr>
                        <tr>
                            <th>ThinkPHP</th>
                            <td><?php echo htmlentities(app()->version()); ?></td>
                        </tr>
                        <tr>
                            <th>上传附件限制</th>
                            <td><?php echo ini_get("upload_max_filesize"); ?></td>
                        </tr>
                        <tr>
                            <th>执行时间限制</th>
                            <td><?php echo ini_get("max_execution_time"); ?>s</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <style id="welcome_style"></style>
        <div class="layui-col-md12">
            <blockquote class="layui-elem-quote layui-quote-nm">本系统由 泰雁科技 提供技术支持。</blockquote>
        </div>
    </div>
</div>
</div>
</body>
<script language="JavaScript">
    layui.use(['table', 'form','laydate'],function() {
        let table = layui.table
            ,form = layui.form
            ,laydate = layui.laydate;
        laydate.render({
            elem: '#date'
            ,type: 'date' //默认，可不填
        });
        laydate.render({
            elem: '#month'
            ,type: 'month' //默认，可不填
        });
        form.on('radio(type)', function(data){
            if (data.value == 3){
                $('#month').show();
                $('#date').hide();
                form.render();
            }else {
                $('#month').hide();
                $('#date').show();
                form.render();
            }
        });
        var xAxisData=[];
        var seriesOne=[];
        var seriesTwo=[];
        var aa=[];
        aaaa(aa);
        form.on('submit(search)',function (data) {
            let field = {
                type:data.field['type'],
                time:data.field['type']==3?data.field.time2:data.field.time1
            };
           aaaa(field);
            return false;
        });
        // 基于准备好的dom，初始化echarts实例
        function aaaa(field) {
            $.post('<?php echo url("dataStats"); ?>', field, function (res) {
                if (res.code == 1){
                    xAxisData=res.X_axis;
                    seriesOne=res.member;
                    seriesTwo=res.money;
                    var myChart = echarts.init(document.getElementById('main'));
                    // 指定图表的配置项和数据
                    var option = {
                        title: {
                            text: ''
                        },
                        tooltip: {
                            trigger: 'axis'
                        },
                        legend: {
                            data: ['付费用户', '收益金额']
                        },
                        grid: {
                            left: '3%',
                            right: '4%',
                            bottom: '3%',
                            containLabel: true
                        },
                        toolbox: {
                            feature: {
                                saveAsImage: {}
                            }
                        },
                        xAxis: {
                            type: 'category',
                            boundaryGap: false,
                            data: xAxisData
                        },
                        yAxis: {
                            type: 'value'
                        },
                        series: [
                            {
                                name: '付费用户',
                                type: 'line',
                                data: seriesOne
                            },
                            {
                                name: '收益金额',
                                type: 'line',
                                data: seriesTwo
                            }
                        ]
                    };
                    // 使用刚指定的配置项和数据显示图表。
                    myChart.setOption(option);
                }else {
                    layer.msg(res.msg, {icon: 5,time:1500});
                }
            });

        }
    });

</script>

</html>